package com.siao.example.libaray.component.ui
{
	import com.siao.component.IDataItem;
	import com.siao.component.ISelectItem;
	import com.siao.display.LayoutElement;
	
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	/**
	 * 列表项目
	 * @author SiaoLeon
	 */
	public class ListItem extends LayoutElement implements IDataItem, ISelectItem
	{
		// -------------------------------------------------------------------------------------------------------- 静态常量
		
		// -------------------------------------------------------------------------------------------------------- 静态变量
		
		// -------------------------------------------------------------------------------------------------------- 静态方法
		
		// -------------------------------------------------------------------------------------------------------- 静态函数
		
		// -------------------------------------------------------------------------------------------------------- 属性
		
		public function get data():*
		{
			return this.txtCount.text;
		}
		
		public function set data(value:*):void
		{
			this.txtCount.text = value;
		}
		
		public function get selected():Boolean
		{
			return false;
		}
		
		public function set selected(value:Boolean):void
		{
			this.txtCount.textColor = (value) ? 0XFF0000 : 0X000000;
		}
		
		// -------------------------------------------------------------------------------------------------------- 变量
		
		private var txtCount:TextField;
		
		// -------------------------------------------------------------------------------------------------------- 构造
		
		/**
		 * 构造函数
		 */
		public function ListItem()
		{
			super();
			
			this.txtCount = new TextField();
			this.txtCount.autoSize = TextFieldAutoSize.LEFT;
			this.txtCount.border = true;
			this.addChild(this.txtCount);
			
			this.draw(0XFF0000, 0.2);
			this.height = 100;
		}
		
		// -------------------------------------------------------------------------------------------------------- 方法
		
		// -------------------------------------------------------------------------------------------------------- 函数
		
		override public function toString():String
		{
			return this.txtCount.text;
		}
	}
}
